/**
 * problem_038.cpp
 * Copyright (C) 2011 - xrose
 */

#include <iostream>
using namespace std;
int isDif2digit(int abc, int def)
{
	int chek[9] = {0};
	int c;

	while(abc>0)
	{
		c = abc%10;
		if((c!=0)&&(chek[c-1]==0))
		{
			chek[c-1]=1;
			abc = abc/10;
		}else
		{
			return 0;
		}
	}

	while(def>0)
	{
		c = def%10;
		if((c!=0)&&(chek[c-1]==0))
		{
			chek[c-1]=1;
			def = def/10;
		}else
		{
			return 0;
		}
	}
	return 1;
}

int main (int argc, char const* argv[])
{
    /**
     * if n>2 the pandigital alway smaller than 9xxxxxxxx
     * so n =2 :D
     */
     int abc = 9876;
     int def = 0;
     while(1)
     {
         def = abc*2;
         if(isDif2digit(abc, def))
         {
             cout<<"Resul: "<<abc<<def<<endl;
             break;
         }else
         {
             abc--;
         }
     }
	return 0;
}
